<?php
$menuclassinfo = $this->tables['menuclassinfo'];
$menuitem = $this->tables['menuitem'];
//print_rr($menuclassinfo);
$appmodulename = '';
$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$actionname = 'add';
if ($id > 0) {
    $actionname = 'edit';
    $appmodulename = $menuclassinfo['companyname'] . '-' . $menuclassinfo['projectname'] . '_' . $menuclassinfo['modulename'];
}
$parentdir = $menuclassinfo['parentdir'];
if ($parentdir == '')
    $parentdir = '(顶层菜单分类)';
?>
<script>
    (function($){
        $("#settopclass").click(function(){
            $("#parentclassinfo_parentdir").val("(顶层菜单分类)");
            $("#parentclassinfo_id").val("0");
        });
        $("input[name^=virtitems]").each(function(){
            $(this).parent().css("cursor",'pointer');
            $(this).parent().click(function(){
                $(this).find("input").attr("checked",!$(this).find("input").attr("checked"));
            });
        });
    })(jQuery);
</script>
<div class="pageContent">
    <form method="post" action="?c=<?= app::$CONTROLLER_NAME ?>&a=<?= $actionname ?>&id=<?= $id ?>" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
        <div class="pageFormContent" layoutH="56">
            <dl>
                <dt>所属项目模块：</dt>
                <dd>
                    <input type="text" name="parentclassinfo.appmodulename" readonly="readonly" class="required" value="<?= $appmodulename ?>"/>
                    <input type="hidden" target="projmoduleid" id="projmoduleid" name="parentclassinfo.projmoduleid" readonly="readonly" value="<?= $menuclassinfo['projmoduleid'] ?>"/>
                    <a class="btnLook" href="?c=sys_projmodule&a=list" lookupGroup="projmoduleinfo">查找带回</a>

                </dd>
            </dl>
            <dl>
                <dt>所属菜单分类：</dt>
                <dd>
                    <input type="text" id="parentclassinfo_parentdir"  name="parentclassinfo.parentdir" class="required" readonly="readonly" value="<?= $parentdir ?>"/>
                    <input type="hidden" name="parentclassinfo.id" readonly="readonly" value="<?= $menuclassinfo['parentid'] ?>"/>
                    <a class="btnLook" href="?c=sys_menuclass&a=list&projmoduleid={projmoduleid}" lookupGroup="parentclassinfo">查找带回</a>
                    <a href="javascript:void(0)" id="settopclass">设为顶层</a>
                </dd>
            </dl>
            <dl>
                <dt>菜单分类名称：</dt>
                <dd><input type="text" name="name" class="required" value="<?= $menuclassinfo['name'] ?>" alt=""/></dd>
            </dl>
            <dl>
                <dt>菜单分类标题：</dt>
                <dd><input type="text" name="title" class="required" value="<?= $menuclassinfo['title'] ?>" alt=""/></dd>
            </dl>
            <dl>
                <dt>是否启用：</dt>
                <dd><span style="color:green;"><input type="radio" name="enable" value="1" <? if ($menuclassinfo['enable'] == 1) { ?>checked="checked"<? } ?> />启用</span>
                    <span style="color:red;"><input type="radio" name="enable" value="0" <? if ($menuclassinfo['enable'] == 0) { ?>checked="checked"<? } ?> />禁用</span></dd>
            </dl>
            <dl>
                <dt>是否显示：</dt>
                <dd><span style="color:green;"><input type="radio" name="visible" value="1" <? if ($menuclassinfo['visible'] == 1) { ?>checked="checked"<? } ?> />显示</span>
                    <span style="color:red;"><input type="radio" name="visible" value="0" <? if ($menuclassinfo['visible'] == 0) { ?>checked="checked"<? } ?> />隐藏</span></dd>
            </dl>
            <dl>
                <dt>默认菜单项：</dt>
                <dd>
                    <select class="combox required" name="defaitemid">
                        <option value="0">--不设定--</option>
                        <? foreach ($menuitem as $row) { ?>
                            <option<? if ($row['id'] == $menuclassinfo['defaitemid']) { ?> selected="selected"<? } ?> value="<?= $row['id'] ?>"><?= $row['name'] ?>(<?= $row['title'] ?>)</option>
                        <? } ?>
                    </select>
                </dd>
            </dl>
            <!--
            <dl>
                <dt>设置虚拟菜单：</dt>
                <dd>
                    <span><input type="checkbox" name="virtitems[list]" value="1" />列表</span>
                    <span><input type="checkbox" name="virtitems[info]" value="1" />查看详细</span>
                    <br />
                    <span style="color:green"><input type="checkbox" name="virtitems[add]" value="1" />增加</span>
                    <span style="color:blue"><input type="checkbox" name="virtitems[edit]" value="1" />修改</span>
                    <span style="color:red"><input type="checkbox" name="virtitems[del]" value="1" />删除</span>
                </dd>
            </dl>
            -->
        </div>
        <div class="formBar">
            <ul>
                    <!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
                <li>
                    <div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
                </li>
            </ul>
        </div>
    </form>
</div>
